<%@ page contentType="text/html;charset=UTF-8"%>
<%@include file="module/common.jsp"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="cosmo云工厂">
<meta name="Keywords" content="cosmo,cosmo云工厂">
<title>cosmo云工厂</title>
<link href="${ctxStatic}/cloudfactory/css/basic.css" rel="stylesheet"
	type="text/css" />
<link href="${ctxStatic}/cloudfactory/css/main.css" rel="stylesheet"
	type="text/css" />
<link href="${ctxStatic}/cloudfactory/css/flex.css" rel="stylesheet"
	type="text/css" />
<link href="${ctxStatic}/cloudfactory/css/cloudFoundry.css"
	rel="stylesheet" type="text/css" />
<!–[if lt IE9]>
<script src="${ctxStatic}/cloudfactory/js/html5.js"></script>
<![endif]–>
</head>

<body>
	<div class="sys_warp">
		<!--header开始-->
		<jsp:include page="module/head.jsp" flush="true" />
		<!--header结束,banner开始-->
		<div class="container child_container">
			<div class="sys_width">
				<!--登录-->
				<section class="loginBox">
					<div class="logTitle tx-center">
						<h3 class="tc-fff">用户登录</h3>
					</div>
					<div class="logCont bc-fff">
						<form action="" autocomplete="off">
							<div class="ps_r inputBox">
								<span>账户名</span> <input type="text" name="name" id="name">
							</div>
							<div class="ps_r inputBox">
								<span>密&emsp;码</span> <input type="password" name="password"
									id="psw">
							</div>
							<div class="clearfix" style="width:55%;margin:0 auto;">
                            <div class=" tx-left float_l"><a class="tc-yel" href="${ctx}/loginCenter/goRegister">注册</a></div>
                            <div class=" tx-right float_r"><a class="tc-yel" href="###">忘记密码？</a></div>
                        </div>
							
						</form>
						<button class="bc-blue tc-fff" onclick="login()" type="submit">登录</button>
					</div>
				</section>
			</div>
		</div>
		<!--主体结束,footer开始-->
		<jsp:include page="module/foot.jsp" flush="true" />
		<!--footer结束-->
	</div>
</body>
<script type="text/javascript"
	src="${ctxStatic}/cloudfactory/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
	src="${ctxStatic}/cloudfactory/js/main.js"></script>
<script>
	function login() {
		debugger;
		var name = $("#name").val();
		var psw = $("#psw").val();
		if (psw == null || psw == "") {
			alert("密码不能为空");
			return;
		}
		if (name == null || name == "") {
			alert("用户名不能为空");
			return;
		}
		$.ajax({
			//几个参数需要注意一下
			type : "GET",//方法类型
			dataType : "json",//预期服务器返回的数据类型
			url : "${ctx}/loginCenter/login",//url
			data : {
				name : name,
				psw : psw
			},
			success : function(result) {
				debugger;
				if (result.success == "success") {
					alert("登录成功");
					window.location.href = "${ctx}/loginCenter/goIndex?id="+result.id;
				} else {
					alert(result.success);
					return;
				}
			},
			error : function(result) {
				alert("登录异常");
				return;
			}
		});
	}
	$(function() {
		indexInit();
	});
</script>
</html>